@echo off
echo "==>TAO_ROOT=%TAO_ROOT%"

set PROJECT_PATH="%TAO_ROOT%/orbsvcs/tests/FT_App/"

cd %PROJECT_PATH%


@echo off
setlocal

:: 定义要删除的文件列表
set "files=*.ior"

:: 删除文件
for %%f in (%files%) do (
    if exist "%%f" (
        echo Deleting %%f...
        del "%%f"
        if not errorlevel 1 (
            echo Deleted %%f successfully.
        ) else (
            echo Error deleting %%f.
        )
    ) else (
        echo %%f does not exist. Skipping.
    )
)


::1) Start ft_replica1
echo "==>Start ft_replica1"
start "ft_replica1" cmd /k "ft_replica -o %PROJECT_PATH%\factory1.ior -t %PROJECT_PATH%\replica1.ior -q -f none -p %PROJECT_PATH%\persistent.dat"
timeout /t 3
::2) Start ft_replica2
echo "==>Start ft_replica"
start "ft_replica2" cmd /k "ft_replica -o %PROJECT_PATH%\factory2.ior -t %PROJECT_PATH%\replica2.ior -q -f none -p %PROJECT_PATH%\persistent.dat"
timeout /t 3
::3) Start ft_client
echo "==>Start ft_client"
start "ft_client" cmd /k "ft_client -f file://%PROJECT_PATH%\replica1.ior -f file://%PROJECT_PATH%\replica2.ior -c testscript"


@REM pause >nul
@echo off
